package factoryMode.prefectDemo.simple.factory;

import factoryMode.prefectDemo.simple.fruit.Apple;
import factoryMode.prefectDemo.simple.fruit.Fruit;
import factoryMode.prefectDemo.simple.fruit.Pear;

/**
 * @author： pang-yun
 * @date： 2021-10-22 00:37
 * 功能目的 ：用于
 */

public class FruitFactory {
    public static Fruit createFruit(String type){
        if (type.equals("Apple")){
            return new Apple();
        }else if (type.equals("Pear")){
            return new Pear();
        }else {
            return null;
        }
    }
}
